//
//  YWMission.h
//  maintain
//
//  Created by 郑想 on 15/11/4.
//  Copyright © 2015年 ewin. All rights reserved.
//

#import "YWDictMaintenanceType.h"
#import <Foundation/Foundation.h>

@class YWHandler;
@class YWLocation;
@class YWFloor;
@class YWApartment;
@class YWBuilding;
@class YWEquipment;
@class YWShortBuilding;
@class YWShortEquipmentType;

typedef NS_ENUM(NSUInteger, YWMissionStatus) {
    YWMissionStatusUnfinished = 0, //未完成
    YWMissionStatusFinished = 1, //已完成
    YWMissionStatusExpire = 2, //已过期
};
typedef NS_ENUM(NSUInteger, YWMissionFinishStatus) {
    YWMissionFinishStatusUnfinished = 0, //未完成
    YWMissionFinishStatusFinishedAndExpire = 1, //已完成和已过期
};
typedef NS_ENUM(NSUInteger, YWTroubleMissionStatus) {
    YWTroubleMissionStatusUnAssign = 0, //未分配
    YWTroubleMissionStatusAssign = 1, //已分配
    YWTroubleMissionStatusFinish = 2, //已完成
    YWTroubleMissionStatusCancelPostTrouble = 3, //取消故障单
};

typedef NS_ENUM(NSUInteger, YWPostTroubleType) {
    YWPostTroubleTypeEwinApp = 0, //从手机app端
    YWPostTroubleTypeWeChat = 1, //微信报障
    YWPostTroubleTypeWebSite = 2, //网页报障
};

typedef NS_ENUM(NSUInteger, YWMissionSiteType) {
    YWMissionSiteTypeNoSize = 0, //不限位置
    YWMissionSiteTypeApartment = 1, //楼栋
    YWMissionSiteTypeFloor = 2, //楼层
};

typedef NS_ENUM(NSUInteger, YWMissionCycle) {
    YWMissionCycleNull = 0, //不循环
    YWMissionCycleYear = 1, //年度
    YWMissionCycleHalfYear = 2, //半年
    YWMissionCycleQuarter = 3, //季度
    YWMissionCycleMonth = 4, //每月
    YWMissionCycleWeek = 5, //每周
    YWMissionCycleDay = 6, //每日
};

typedef NS_ENUM(NSUInteger, YWMissionType) {
    YWMissionTypeManually = 0, //手动分配
    YWMissionTypeAuto = 1, //自动生成
};
typedef NS_ENUM(NSUInteger, YWTroubleMissionType) {
    YWTroubleMissionTypeAssign = 0, //分配
    YWTroubleMissionTypeGrabBill = 1, //抢单
};

@interface YWLocationRel : NSObject
@property (nonatomic, strong) YWFloor* floor;
@property (nonatomic, strong) YWApartment* apartment;
@end


@interface YWSite : NSObject
@property (nonatomic, assign) NSInteger siteId; //	位置ID	楼栋ID或者楼层ID
@property (nonatomic, copy) NSString* siteType; //	位置类型	A：楼栋，F：楼层
@property (nonatomic, assign) NSInteger siteTypeId;
@property (nonatomic, assign) NSInteger equipmentTypeId;
@property (nonatomic, strong) YWLocationRel*  locationRel;
@end

@interface YWMission : NSObject
//--------------把维保和维修两种任务的相同属性放到父类中

/**是否上传失败*/
@property (nonatomic, assign) BOOL uploadFail;
/**是否已读 完成后判断*/
@property (nonatomic, assign) BOOL read;
/**任务是否收起来*/
@property (nonatomic, assign) BOOL isOpen;
/**维保任务的某个设备类型的设备数组*/
@property (nonatomic, strong) NSArray *equipmentsArray;
/**做任务的图片数组*/
@property (nonatomic, strong) NSArray* totalImageNameArray;
/**做任务的时候填写的备注说明*/
@property (nonatomic, copy) NSString* psText;
@end

@interface YWEquipmentIdJson : NSObject
@property (nonatomic, copy) NSString *equipmentId;
@end

@interface YWMaintenanceMission : YWMission
/**维保任务ID*/
@property (nonatomic, assign) NSInteger missionId;
/**任务编号*/
@property (nonatomic, copy) NSString* missionSequence;
/**维保任务名称*/
@property (nonatomic, copy) NSString* missionName;
/**维保任务循环周期*/
@property (nonatomic, assign) YWMissionCycle missionCycle;
/**任务类型(手动，自动)*/
@property (nonatomic, assign) YWMissionType type;
/**设备对象集合(只有equipmentId),当系统自动生成(type=1)的任务时,将包含该参数*/
@property (nonatomic, strong) NSArray *equipments;
/**维保类型ID*/
@property (nonatomic, assign) YWMaintenanceType maintenanceTypeId;
/**任务开始时间*/
@property (nonatomic, assign) NSTimeInterval startTime;
/**任务截止时间*/
@property (nonatomic, assign) NSTimeInterval cutoffTime;
/**任务状态0:未执行；1：已执行;2:已过期*/
@property (nonatomic, assign) YWMissionStatus missionStatus;
/**数据状态0:正常；-1：已删除*/
@property (nonatomic, assign) NSInteger status;
/**创建时间*/
@property (nonatomic, assign) NSTimeInterval createTime;
/**更新时间*/
@property (nonatomic, assign) NSTimeInterval updateTime;
/**设备类型ID*/
@property (nonatomic, assign) NSInteger equipmentTypeId;
/**设备类型对象*/
@property (nonatomic, strong) YWShortEquipmentType *equipmentType;
/**任务设备数量*/
@property (nonatomic, assign) NSInteger equipmentQuantity;
/**已完成设备数量*/
@property (nonatomic, assign) NSInteger completedQuantity;
/**维保执行者数组*/
@property (nonatomic, strong) NSArray* executors;
/**维保执行者id串*/
@property (nonatomic, copy) NSString* executorIds;
/**维保的任务备注*/
@property (nonatomic, copy) NSString* note;
/**楼盘Id*/
@property (nonatomic, copy) NSString* buildingId;
/**楼盘Id*/
@property (nonatomic, strong) YWShortBuilding* building;
/**创建者*/
@property (nonatomic, strong) YWHandler* creator;
/**@的人集合*/
@property (nonatomic, strong) NSArray *observers;
/**@的人的id串*/
@property (nonatomic, copy) NSString *observerIds;
/**评论*/
@property (nonatomic, strong) NSArray *replies;


/**做任务的结果(正常，故障,这个数组存放报障的设备id)*/
@property (nonatomic, strong) NSArray *maintenanceEquipmentId;
/**做任务的规则数组*/
@property (nonatomic, strong) NSArray* missionRules;


/**完成时间 只用于显示排序*/
@property (nonatomic, assign) NSTimeInterval finishTime;
@end


//微信保障的人
@interface YWTroubleContact : NSObject
/**任务ID*/
@property (nonatomic, assign) NSInteger troubleId;
/**保障人名字*/
@property (nonatomic, copy) NSString *contactName;
/**保障人电话*/
@property (nonatomic, copy) NSString *contactNo;
@end


//---
@interface YWTroubleEquipmentTypeJson : NSObject
/**设备类型*/
@property (nonatomic, assign) NSInteger equipmentTypeId;
@end


//检测保养任务的状态
@interface YWMissionStatusJson : NSObject
/**任务ID*/
@property (nonatomic, assign) NSInteger missionId;
/**0：正常，-1：删除*/
@property (nonatomic, assign) NSInteger status;
/**创建者*/
@property (nonatomic, strong) YWHandler* creator;
/**执行者*/
@property (nonatomic, strong) NSArray* executors;
/**任务设备数量*/
@property (nonatomic, assign) NSInteger equipmentQuantity;
/*完成数量*/
@property (nonatomic, assign) NSInteger completedQuantity;
/*维保类型*/
@property (nonatomic, assign) NSInteger maintenanceTypeId;
@end

@interface YWTroubleIdJson : NSObject
/**任务ID*/
@property (nonatomic, assign) NSInteger troubleId;
@end

